<!-- 教练 – 我的 – 我的课程		kecheng	 -->
<template>
	<view class="">
		<view>
			<u-tabs-swiper  :list="list" bg-color="#fff" :current="current" @change="tabsChange" :is-scroll="false"
				></u-tabs-swiper>
		</view>
		<view class="kecheng-top mt15" v-if="listsa != ''" @click="godetails(item)" v-for="(item,index) in listsa" :key="index">
			<view class="dis-flex  p10">
				<view>
					<image style="width: 248rpx;height: 156rpx;" :src="item.course_img" mode=""></image>
				</view>
				<view class="ml10 wd60">
					<view class="fs28 bold ellipsis wd100">{{item.course_name}}</view>
					<view class="fs20 hui p_t_10 ellipsis-2 wd100" style="min-height: 90rpx;">{{item.course_title}}{{item.course_name}}{{item.course_name}}{{item.course_name}}{{item.course_name}}{{item.course_name}}{{item.course_name}}{{item.course_name}}</view>
					<view class="f b ">
							<view class="hui fs20">时间:{{item.timestr}}</view>
							<view class="hui fs20">{{item.is_study == 0?"未开课":"已完结"}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="dis-flex flex-align-center flex-center" style="height: 1000rpx;"  v-if="listsa == ''">
			<u-empty text="暂无课程" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show:false,
				listsa: [],
				list: [{
					name: '全部课程'
				}, {
					name: '未开课'
				}, {
					name: '已完结'
				}],
				current: 0, // tabs组件的current值，表示当前活动的tab选项
			}
		},
		onLoad() {
			// 动态导航条文字
			uni.setNavigationBarTitle({
				title: '我的课程'
			})
			this.init()
		},
		methods: {
			init(){
				var json = {
					tag: this.current
				}
				this.$http.post(this.$config.UrlPostmyCourse, json).then((res) => {
					if (res.status == 1) {
						this.listsa = res.data
					}
				})
			},
			tabsChange(index) {
				this.current = index;
				this.init()
			},
			godetails(item){
				var data = encodeURIComponent(JSON.stringify(item))
				this.$api.openWindow("/pages/details/details?data="+data)
			}
		}
	}
</script>

<style scoped>
	.warps {
		/* height:180vh; */
		overflow: hidden;
		background-color:#F6F8FC;
	}
	.kecheng-top{
		width: 686rpx;
		opacity: 1;
		background: #ffffff;
		border-radius: 8rpx;
		box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0,0,0,0.16); 
		margin:0 auto;
	}
	.information-buts>button{
		width: 160rpx;
		height: 36rpx;
		line-height:36rpx;
		opacity: 1;
		background: #f1f6ff;
		border-radius: 18rpx;
		font-size:20rpx;
		color: #1f73f2;
	}
</style>
